// 名词解释
// symbol => 交易对
// coin => 币

// ===================交易对列表

// 母币item
interface ICoinMu {
  coin: string;
  lists: Array<ICoinZi>;
}

// 子币item
interface ICoinZi {
  coin: string;
  lastPrice: string;
  change: string;
  h: string;
  l: string;
  v: string;
  curency: null;
  amountDec: "10000";
  priceDec: "100000";
  love: boolean;
}

// 母币
const coinMu: ICoinMu = {
  coin: "BTC", // 母币
  lists: [
    // 子币
    {
      coin: "GPX",
      lastPrice: "53.00000000", // 若系统最大精度为 8 就是 8 ,涉及到数据统一 8 位
      change: "0.22", // 涉及百分比统一小数表示 0.22 => 22%
      h: "6800.00000000",
      l: "5500.00000000",
      v: "3.00000000",
      curency: null, // 这个为以后转法币 预留,
      amountDec: "10000", // 由于 js 当精度到达 一定位数 会变成 科学技术法 所以 后台用整数 代表精度 ，前台 用 1 / 10000 => 0.0001 来转换
      priceDec: "100000", // 同数量精度一样 1 / 100000 => 0.00001,
      love: false // 是否为收藏
    }
  ] // 子币列表
};

// 交易对列表
const symbolLists: Array<ICoinMu> = [coinMu, coinMu];

// ================交易对收藏列表

const loveLists: Array<ICoinMu> = [coinMu, coinMu]; // 这里数据结构和交易对列表一样，区别在于  子币列表内只有一个 item

// ====================最新成交

interface TradeItem {
  date: number;
  type: "sell" | "buy";
  amount: string;
  price: string;
}

// 精度列表
const TradeLists: Array<TradeItem> = [
  {
    date: 1541906588, // 严格统一使用 unix时间戳
    type: "sell", // 卖 或 买
    amount: "53.00000000",
    price: "5500.00000000"
  }
];

// ========================深度

interface DepthItem {
  type: "sell" | "buy";
  price: string;
  amount: string;
  total: string;
  bar: number;
}

const depthLists: Array<DepthItem> = [
  {
    type: "sell",
    price: "53.00000000",
    amount: "52.00000000",
    total: "100.00000000",
    bar: 0.01 // 精度严格为2位 0.01 => 1%
  }
];

// ======================订单

interface OrderItem {
  id: string;
  date: number;
  zi: string;
  mu: string;
  type: "sell" | "buy";
  price: string;
  amount: string;
  executed: string;
}

const orderLists: Array<OrderItem> = [
  {
    id: "23jlsjdflksdjflkj",
    date: 1541906588,
    zi: "BTC",
    mu: "USD",
    type: "sell",
    price: "0.00000001",
    amount: "33.00000000",
    executed: "3.33333309"
  }
];

// ====================下单 买 | 卖

interface IOrderRequestPayload {
  amount: string;
  type: "sell" | "buy";
  price: string;
  zi: string;
  mu: string;
  userId: string;
}

// 下单请求
const orderRequestPayload = {
  amount: "22.00000000",
  type: "sell",
  price: "0.00000001",
  zi: "BTC",
  mu: "USD",
  userId: "sdlkjflkdsjfkldsjlfjlsd"
};

interface IAvaCoinItem {
  coin: string;
  ava: string;
}

// 可用余额 列表
const avaCoinLists: Array<IAvaCoinItem> = [
  {
    coin: "BTC",
    ava: "0.00000001"
  }
];

// ==========================k线

// 交易对配置
interface SymbolConfig {
  has_daily: boolean;
  ticker: string;
  has_weekly_and_monthly: boolean;
  minmov2: number;
  timezone: string;
  session: string;
  has_intraday: boolean;
  description: string;
  supported_resolutions: Array<string>;
  type: string;
  intraday_multipliers: Array<string>;
  volume_precision: number;
  pointvalue: number;
  has_empty_bars: boolean;
  name: string;
  minmov: number;
  pricescale: number;
  has_no_volume: boolean;
}

// 除了后端动态设置 其他属性 写死
const symbolConfig: SymbolConfig = {
  has_daily: true,
  ticker: "BTCUSD", // 后端动态设置
  has_weekly_and_monthly: true,
  minmov2: 0,
  timezone: "GMT",
  session: "24x7",
  has_intraday: true,
  description: "BTC/USD", // 后端动态设置
  supported_resolutions: ["1", "5", "15", "30", "60", "D", "W"],
  type: "stock",
  intraday_multipliers: ["1", "5", "15", "30", "60", "D", "W"],
  volume_precision: 4,
  pointvalue: 1,
  has_empty_bars: true,
  name: "BTCUSD", // 后端动态设置
  minmov: 1,
  pricescale: 100, // 后端动态设置
  has_no_volume: false
};

// k线数据
interface LineLists {
  c: Array<string>; // 关
  h: Array<string>; // 高
  l: Array<string>; // 低
  o: Array<string>; // 开
  s: "ok";
  t: Array<number>; // 时间戳
  v: Array<string>; // 量
}

const lineLists: LineLists = {
  c: ["6276.09981854", "6263.04283138"],
  h: ["6299.37528167", "6281.42641637"],
  l: ["6271.46866632", "6258.71664018"],
  o: ["6277.28604149", "6276.09981854"],
  s: "ok",
  t: [1536728400, 1536732000], // 这里注意 时间一定是 线性递增 的
  v: ["0.4468", "0.4234"]
};

// 这里最主要的作用是 时间刻度的配置 写死即可
const quoteConfig = {
  supports_marks: false,
  supports_time: true,
  exchanges: [
    { name: "All Exchanges", value: "", desc: "" },
    { name: "NasdaqNM", value: "NasdaqNM", desc: "NasdaqNM" },
    { name: "NYSE", value: "NYSE", desc: "NYSE" },
    { name: "NGM", value: "NGM", desc: "NGM" },
    { name: "NCM", value: "NCM", desc: "NCM" }
  ],
  supports_search: true,
  supports_group_request: false,
  supported_resolutions: ["1", "5", "15", "30", "60", "D", "W"],
  symbols_types: [
    { name: "All types", value: "" },
    { name: "Stock", value: "stock" },
    { name: "Index", value: "index" }
  ],
  supports_timescale_marks: false
};

// serveTime  服务器时间

const time = 1541910566;
